<?php
namespace Home\Controller\Mobile;
use Home\Controller\Mobile\BasicController;

class OrderController extends BasicController {
	
	public function orderlist(){
		$userdata = session('user');
		$uid = $userdata['uid'];
		$flag = I('request.flag')==''?'all':I('request.flag');
		if($flag=='success'){
			$where['o.status'] = array('in','1,2,3,4,5,6');
		}elseif($flag=='fail'){
			$where['o.status'] = -1;
		}elseif($flag=='check'){
			$where['o.status'] = 0;
		}
		$where['o.uid'] = $uid;
		$list = M('sxkj_offline_order o')->field("o.*,p.title,p.img,p.path,p.cycle,p.taskid")
			->join(C('DB_PREFIX')."sxkj_offline_project p ON p.id=o.pid",'LEFT')
			->order('o.add_time desc')
			->where($where)->select();
		
		$this->assign('flag',$flag);
		$this->assign('list',$list);
		$this->display();
	}
 	
}